﻿@model Category
@using EasyMvc.Models
@using EasyMvc.Controls
@using EasyMvc.Web.Common
@{
    Layout = "~/Areas/MWeb/Views/Shared/_Layout.Edit.cshtml";
}
@section PageSpecificStyleSheetIncludes{
    <link href="@Url.Content("~/Static/uploadify/uploadify.css")" rel="stylesheet" type="text/css" />
}
@section PageSpecificJavascriptIncludes{
    <script type="text/javascript" src="@Url.Content("~/Static/uploadify/swfobject.js")"></script>
    <script type="text/javascript" src="@Url.Content("~/Static/uploadify/jquery.uploadify.v2.1.4.js")"></script>
    <script type="text/javascript" src="@Url.Content("~/Static/Scripts/flashupload.js")"></script>
    <script type="text/javascript">
        $(document).ready(function () {
            //Init Map
            $("#tabs").tabs();

            var uploadPath = "/FileUpload.ashx?folder=categorypictures";

            $('#fileUploadPanel').FileUpload(uploadPath,
                function (msg) {
                    $("#picture").attr("src", GetThumPath(msg.url));
                    $("#PictureUrl").val(msg.url);
                });
            });

             //Get thum picture
            var GetThumPath = function (path) {
                var ext = path.substring(path.lastIndexOf('.'));
                var head = path.substring(0, path.lastIndexOf('.'));
                return head + "_s" + ext;
            }
   </script>
}
@section MainContent{
    <div id="tabs">
        <ul>
            <li><a href="#tabs-1">基本信息</a></li>
            <li><a href="#tabs-2">父类信息</a></li>
        </ul>
        <div id="tabs-1">
            <div class="editItem">
                <span class="label"><span class="rq">*</span>名称：</span>
                @Html.EditorFor(model => model.Name)
                <p>@Html.ValidationMessageFor(model => model.Name)</p>
            </div> 
            <div class="editItem">
                <span class="label"><span class="rq">*</span>排行：</span>
                @Html.EditorFor(model => model.Rating) 
                将在首页显示，越大越靠前
                <p>@Html.ValidationMessageFor(model => model.Rating)</p>
                
            </div>

            <div class="ui-state-highlight ui-corner-all">  
                    首页上将显示 有图片的，排行越大的分类图标Top3
            </div>

            <div class="editItem" style="padding:10px">
                <span>上传图标图片：</span><br />
                <input type="file" name="fileUploadPanel" id="fileUploadPanel" />
                <div id="fileQueue"></div>
                <div>
                    <img id="picture" src='@Url.ImageFile(Model.PictureUrl, "s")'/>
                    @Html.Hidden("PictureUrl")
                </div>
            </div>
        </div>
        <div id="tabs-2">
            
        </div>
    </div>
}


